Hệ thống quản lý phương tiện trong PHP
1 <?php
2 $connection= mysqli_connect('localhost','root','','vehiclemanagement');
3 session_start();
4
5 $msg="";
6
7 if(isset($_POST['submit'])){
8 $name=$_POST['name'];
9 $department=$_POST['department'];
10 $type=$_POST['type'];
11 $req_date=$_POST['req_date'];
12 $req_time=$_POST['req_time'];
13 $return_date=$_POST['return_date'];
14 $return_time=$_POST['return_time'];
15 $destination=$_POST['destination'];
16 $pickup=$_POST['pickup'];
17 $reason=$_POST['reason'];
18 $email=$_POST['email'];
19 $mobile=$_POST['mobile'];
20 $username= $_POST['username'];
21
22 $insert_query="INSERT INTO `booking`(`booking_id`, `name`,`username` , `department`, `type`, `req_date`, `req_time`, `ret_date`, `ret_time`, `destination`, `pickup_point`, `resons`, `email`, `mobile`, `confirmation`, `veh_reg`, `driverid`, `finished`) VALUES ('','$name','$username','$department','$type','$req_date','$req_time','$return_date','$return_time','$destination','$pickup','$reason','$email','$mobile','','','','')";
23 echo $name;
24
25
26
27
28 $res= mysqli_query($connection,$insert_query);
29
30 if($res==true){
31 $msg= "<script language='javascript'>
32 swal(
33 'Success!',
34 'Registration Completed!',
35 'success'
36 );
37 </script>";
38
39 }
40 else{
41 die('unsuccessful' .mysqli_error($connection));
42 }
43
44
45 }
46 ?>
47 <!DOCTYPE html>
48 <html lang="en">
49 <head>
50 <meta charset="UTF-8">
51 <title>Document</title>
52
53
54
55
56
57 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
58
59
60 <link rel="stylesheet" href="sweetalert2/sweetalert2.css">
61 <script src="sweetalert2/sweetalert2.min.js"></script>
62
63 <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
64
65 </head>
66 <body>
67 <?php echo $msg;
68 ?>
69
70 <script>
71
72 var timer = setTimeout(function() {
73 window.location='booking.php'
74 }, 1000);
75 </script>
76
77 </body>
78 </html>